*** Settings ***
Documentation    租号玩app接口自动化测试用例
Library          database_lib.testdb.TestDataBaseLibrary
Library          comm_lib.CommLibrary
Library          init_lib.InitDataLibrary
Library          verify_lib.VerifyLibrary
Resource         suites/resource.robot
Test Teardown  save case info  ${SUITE NAME}

*** Keywords ***
LoginKw
    ${user} =  get user info
    ${sign} =  get sign  ${user[0]}  ${user[1]}
    update test data req json by name  login  username=${user[0]}  password=${user[1]}  sign=${sign}
    When login
    log response info
    ${token} =  parse resp json  data.token
    Then common verify
    [Return]  ${token}

GetTokenKw
    [Arguments]  ${env}
    ${token} =  run keyword if  '${env}' == 'test'
    ...     LoginKw
    ...     ELSE
    ...     get token by env
    [Return]  ${token}

*** Test Cases ***
zhwApp_001
    [Tags]  掌上商软二期-登录注册
    [Documentation]  新登录
    ${env} =  get env
    ${token} =  GetTokenKw  ${env}
    set suite variable  ${token}

zhwApp_002
    [Tags]  订单&买卖服务
    [Documentation]  卖家----出租订单列表
    update test data req json by name  leaseOrder  token=${token}
    When leaseOrder
    log response info
    common verify
    ${actId} =  parse resp json  data[0].act_id
    ${orderId} =  parse resp json  data[0].id
    set suite variable  ${actId}
    set suite variable  ${orderId}

zhwApp_003
    [Tags]  订单&买卖服务
    [Documentation]  卖家----出租订单列表
    update test data req json by name  leaseOrderToday  token=${token}  actId=${actId}
    When leaseOrderToday
    log response info
    common verify

zhwApp_004
    [Tags]  租赁下单
    [Documentation]  租赁商品详情
    update test data req json by name  actRentDetailNew  token=${token}  id=${actId}
    When actRentDetailNew
    log response info
    Then common verify

zhwApp_005
    [Tags]  租赁下单
    [Documentation]  租赁商品详情(参数id值为37或者38时(加速器详情页处理))
    ${ids} =  create list  ${37}  ${38}
    FOR    ${id}    IN   @{ids}
        update test data req json by name  actRentDetailNew  id=${id}
        When actRentDetailNew
        Then verify act rent detail new  -1100
        log response info
    END

zhwApp_006
    [Tags]  租赁下单
    [Documentation]  租赁商品详情(账号信息不存在)
    update test data req json by name  actRentDetailNew  id=ssss
    When actRentDetailNew
    log response info
     Then verify act rent detail new  0

zhwApp_007
    [Tags]  租赁下单
    [Documentation]  租赁商品详情(买卖账号)
    update test data req json by name  actRentDetailNew  id=7811566
    When actRentDetailNew
    log response info
    Then verify act rent detail new  2002

zhwApp_008
    [Tags]  租赁下单
    [Documentation]  租赁商品详情(不存在的token)
    update test data req json by name  actRentDetailNew  token=123456
    When actRentDetailNew
    log response info
    Then verify act rent detail new  -1

zhwApp_009
    [Tags]  搜索获取
    [Documentation]  租号大厅
    update test data req json by name  searchRent  token=${token}
    When searchRent
    log response info
    Then common verify

zhwApp_010
    [Tags]  搜索获取
    [Documentation]  租号大厅(不存在的token)
    update test data req json by name  searchRent  token=112334122
    When searchRent
    log response info
    verify invalid login

zhwApp_011
    [Tags]  用户操作
    [Documentation]  检测用户是否受到防沉迷
    update test data req json by name  checkUserIsAntiIndulge  token=${token}
    When checkUserIsAntiIndulge
    log response info
    verify check user is anti indulge

zhwApp_012
    [Tags]  用户操作
    [Documentation]  检测用户是否受到防沉迷(不存在的token)
    update test data req json by name  checkUserIsAntiIndulge  token=112334122a
    When checkUserIsAntiIndulge
    verify invalid login
    log response info

zhwApp_013
    [Tags]  用户操作
    [Documentation]  检测满送活动用户是否满足条件
    update test data req json by name  checkUserPrize  token=${token}
    When checkUserPrize
    log response info
    verify check user prize

zhwApp_014
    [Tags]  用户操作
    [Documentation]  检测满送活动用户是否满足条件(不输入货号id)
    ${request} =  select data by name  checkUserPrize
    ${request} =  convert to dict  ${request.req_json}
    set suite variable  ${hid}  ${request['hid']}
    delete test data req json by name  checkUserPrize  hid
    When checkUserPrize
    verify check user prize  hid
    log response info

zhwApp_015
    [Tags]  用户操作
    [Documentation]  检测满送活动用户是否满足条件(输入不存在的token)
    update test data req json by name  checkUserPrize  token=13312212  hid=${hid}
    When checkUserPrize
    verify invalid login
    log response info

zhwApp_016
    [Tags]  用户操作
    [Documentation]  检测满送活动用户是否满足条件(不输入token)
    delete test data req json by name  checkUserPrize  token
    When checkUserPrize
    verify check user prize  token
    log response info

zhwApp_017
    [Tags]  租号
    update test data req json by name  actRentDetailDataNew  token=${token}
    [Documentation]  租号详情数据 app4.1.6老接口
    When actRentDetailDataNew
    common verify
    log response info

zhwApp_018
    [Tags]  用户信息
    [Documentation]  用户信息
    update test data req json by name  userIndex  token=${token}
    When userIndex
    common verify
    log response info

zhwApp_019
    [Tags]  用户信息
    [Documentation]  用户信息(不存在token)
    update test data req json by name  userIndex  token=1131313
    When userIndex
    log response info
    verify invalid login

zhwApp_020
    [Tags]  用户信息
    [Documentation]  用户信息(不输入token)
    delete test data req json by name  userIndex  token
    When userIndex
    log response info
    verify invalid login

zhwApp_021
    [Tags]  订单&买卖服务
    [Documentation]  卖家----出租订单列表
    update test data req json by name  leaseOrderDetail  token=${token}  orderId=${orderId}
    When leaseOrderDetail
    log response info
    common verify

zhwApp_022
    [Tags]  account账户
    [Documentation]  卖家-修改帐号数据展示（新版）
    update test data req json by name  editAccountNew  actId=${actId}  token=${token}
    When editAccountNew
    log response info
    common verify

zhwApp_023
    [Tags]  订单&买卖服务
    [Documentation]  卖家----出租帐号
    update test data req json by name  accountRentList  keyWords=${actId}  keyType=1  token=${token}
    When accountRentList
    log response info

zhwApp_024
    [Tags]  订单&买卖服务
    [Documentation]  卖家----出租订单列表(输入不存在的token)
    update test data req json by name  leaseOrder  token=122121
    When leaseOrder
    log response info
    verify invalid login

zhwApp_025
    [Tags]  订单&买卖服务
    [Documentation]  卖家----出租订单列表(不输入token)
    delete test data req json by name  leaseOrder  token
    When leaseOrder
    log response info
    verify invalid login

zhwApp_026
    [Tags]  租号
    [Documentation]  当前用户可使用的红包
    update test data req json by name  usableHb  token=${token}
    When usableHb

zhwApp_027
    [Tags]  app店铺
    [Documentation]  店铺大厅
    When dianPuIndex
    log response info
    verify dian pu index
    ${response} =  parse resp json  data.list
    set suite variable  ${shopId}  ${response[0]['id']}

zhwApp_028
    [Tags]  app店铺
    [Documentation]  店铺详情页(缺失参数)
    When dianPuDetail
    log response info
    verify dian_pu detail

zhwApp_029
    [Tags]  app店铺
    [Documentation]  店铺详情页(不存在的店铺)
    update test data req json by name  dianPuDetail  shop_id=122212111111
    When dianPuDetail
    log response info
    verify dian pu detail  True

zhwApp_030
    [Tags]  app店铺
    [Documentation]  店铺详情页
    update test data req json by name  dianPuDetail  shop_id=${shopId}
    When dianPuDetail
    log response info
    common verify

zhwApp_031
    [Tags]  app店铺
    [Documentation]  店铺的主营游戏
    update test data req json by name  mainGame  shop_id=${shopId}
    When mainGame
    log response info
    common verify
    ${gameList} =  parse resp json  data.game_list
    set suite variable  ${gameId}   ${gameList[0]['game_id']}

zhwApp_032
    [Tags]  app--4.1.3
    [Documentation]  游戏&账号标题搜索(id搜索)
    update test data req json by name  gameSearch  keyWord=${gameId}
    When gameSearch
    log response info
    verify success status

zhwApp_033
    [Tags]  app--4.1.3
    [Documentation]  游戏&账号标题搜索(标题搜索)
    update test data req json by name  gameSearch  keyWord=王者荣耀  searchType=actTitle
    When gameSearch
    log response info
    verify success status

zhwApp_034
    [Tags]  推荐货架
    [Documentation]  获取用户弹窗货架
    update test data req json by name  accountVisitRecommend  gameId=${gameId}  act_ids=${actId}  token=${token}
    When accountVisitRecommend
    log response info
    common verify

zhwApp_035
    [Tags]  account账户
    [Documentation]  通过游戏id获取游戏装备
    update test data req json by name  getEquipmentByGameId  gameId=${gameId}  actId=${actId}  token=${token}
    When getEquipmentByGameId
    log response info
    common verify

zhwApp_036
    [Tags]  用户信息
    [Documentation]  获取收藏帐号列表
    update test data req json by name  getCollectList  token=${token}
    When getCollectList
    log response info
    verify get collect list
    ${data} =  parse resp json  data
    set suite variable  ${hid}  ${data[0]['hid']}

zhwApp_037
    [Tags]  我的
    [Documentation]  游戏/游戏圈/资讯 - 加入|取消收藏(收藏的账号不存在)
    update test data req json by name  setCollect  token=${token}
    When setCollect
    log response info
    verify set collect  invalid  0

zhwApp_038
    [Tags]  我的
    [Documentation]  游戏/游戏圈/资讯 - 加入|取消收藏(您已收藏，请勿重复收藏)
    update test data req json by name  setCollect  gid=${hid}
    When setCollect
    log response info
    verify set collect  set  0

zhwApp_039
    [Tags]  我的
    [Documentation]  游戏/游戏圈/资讯 - 取消收藏
    update test data req json by name  setCollect  val=0
    When setCollect
    log response info
    verify set collect  cancel  1

zhwApp_040
    [Tags]  我的
    [Documentation]  游戏/游戏圈/资讯 - 取消收藏(您已取消收藏，请勿重复取消)
    When setCollect
    log response info
    verify set collect  cancel  0

zhwApp_041
    [Tags]  我的
    [Documentation]  游戏/游戏圈/资讯 - 加入收藏
    update test data req json by name  setCollect  val=1
    When setCollect
    log response info
    verify set collect  set  1

zhwApp_042
    [Tags]  我的
    [Documentation]  获取指定条数未读站内消息
    update test data req json by name  getUnReadMsgList  token=${token}
    When getUnReadMsgList
    log response info
    verify get unread msg list

zhwApp_043
    [Tags]  用户信息
    [Documentation]  获取收藏帐号列表（输入不存在的token）
    update test data req json by name  getCollectList  token=1313131
    When getCollectList
    log response info
    verify get collect list without token

zhwApp_044
    [Tags]  用户信息
    [Documentation]  获取收藏帐号列表（不输入token）
    delete test data req json by name  getCollectList  token  auth_token
    When getCollectList
    log response info
    verify get collect list without token

zhwApp_045
    [Tags]  租号
    [Documentation]  新版校验用户余额是否充足
    update test data req json by name  checkUserMoneyNew  token=${token}
    When checkUserMoneyNew
    log response info
    verify check user money new

zhwApp_046
    [Tags]  上号说明
    [Documentation]  文字版上号说明
    When getWordShsm

zhwApp_047
    [Tags]  红包
    [Documentation]  可用红包总数，及推荐红包
    update test data req json by name  getCountUseHongBaoNew  token=${token}
    When getCountUseHongBaoNew

zhwApp_048
    [Tags]  首页相关
    [Documentation]  获取自动登录游戏信息
    When autoLoginGamesNew

zhwApp_049
    [Tags]  订单&买卖服务
    [Documentation]  买家--订单详情
    update test data req json by name  orderDetail  token=${token}
    When orderDetail

zhwApp_050
    [Tags]  APP--4.13
    [Documentation]  热门游戏接口
    ${type_list} =  create list  ${1}  ${2}
    FOR    ${type}    IN   @{type_list}
    update test data req json by name   hotGame  type=${type}
    When hotGame
    Then log response info
    END

zhwApp_051
    [Tags]  首页
    [Documentation]  安卓APP5.2.0首页
    When mainIndex

zhwApp_052
    [Tags]  快速上号
    [Documentation]  获取订单是否修复过
    update test data req json by name  isReplaceByOrder  token=${token}
    When isReplaceByOrder


zhwApp_053
    [Tags]  account账户
    [Documentation]  检测用户是否可以弹窗提醒
    update test data req json by name  checkUserAllowMessage  token=${token}
    When checkUserAllowMessage

zhwApp_054
    [Tags]  活动
    [Documentation]  稀有特惠专区开关
    When activitySwitch

zhwApp_055
    [Tags]  account账户
    [Documentation]  获取充值分层-限制金额
    update test data req json by name  getOrderAndRechargeConf  token=${token}
    When getOrderAndRechargeConf

zhwApp_056
    [Tags]  平台协议
    [Documentation]  杂项others
    When protocol

zhwApp_057
    [Tags]  首页相关
    [Documentation]  获取启动页广告
    When getStartPic

zhwApp_058
    [Tags]  活动
    [Documentation]  获取各种开关接口
    When switcherSet

zhwApp_059
    [Tags]  account账户
    [Documentation]  首页弹窗
    update test data req json by name  antiIndulgeMessage  token=${token}
    When antiIndulgeMessage

zhwApp_060
    [Tags]  搜索获取
    [Documentation]  获取推荐列表4.1.7
    When recommendList

zhwApp_061
    [Tags]  我的
    [Documentation]  检测是否实名认证
    update test data req json by name  checkAntiIndulge  token=${token}
    When checkAntiIndulge

zhwApp_062
    [Tags]  用户信息
    [Documentation]  封杀提示
    update test data req json by name  beKilledAlert  token=${token}
    When beKilledAlert

zhwApp_063
    [Tags]  杂项others
    [Documentation]  图文上号帮助说明
    When getPicShsm

zhwApp_064
    [Tags]  杂项others
    [Documentation]  app收集
    update test data req json by name  suckIndex  token=${token}
    When suckIndex

zhwApp_065
    [Tags]  租赁下单
    [Documentation]  买家----租赁订单
    update test data req json by name  rentOrder  token=${token}
    When rentOrder
    log response info

zhwApp_066
    [Tags]  订单&买卖服务
    [Documentation]  卖家----出租帐号列表上的统计信息
    update test data req json by name  accountRentCount  token=${token}
    When accountRentCount
    log response info

zhwApp_067
    [Tags]  订单&买卖服务
    [Documentation]  卖家--我的出租账号详情
    update test data req json by name  accountRentDetail  token=${token}
    When accountRentDetail
    log response info

zhwApp_068
    [Tags]  我的
    [Documentation]  站内消息列表
    update test data req json by name  msgList  token=${token}
    When msgList
    verify msg list
    log response info

zhwApp_069
    [Tags]  我的
    [Documentation]  站内消息列表(不能存在的token)
    update test data req json by name  msgList  token=134567
    When msgList
    verify msg list without token
    log response info

zhwApp_070
    [Tags]  我的
    [Documentation]  站内消息列表(不输入token)
    delete test data req json by name  msgList  token
    When msgList
    log response info
    verify msg list without token

zhwApp_071
    [Tags]  租号
    [Documentation]  全部游戏，热门非热门
    When gameList
    log response info
    verify success status
    ${gameId} =  parse resp json  data.hot[1].id
    set suite variable  ${gameId}

zhwApp_072
    [Tags]  租号
    [Documentation]  租号大厅游戏属性
    update test data req json by name  filterArr  game_id=${gameId}
    When filterArr
    log response info
    ${zoneId} =  parse resp json  data.zone[1].id
    set suite variable  ${zoneId}
    verify success status

zhwApp_073
    [Tags]  租号
    [Documentation]  租号大厅游戏大区
    update test data req json by name  serverArr  game_id=${gameId}  zone_id=${zoneId}
    When serverArr
    log response info
    verify success status

zhwApp_074
    [Tags]  用户信息
    [Documentation]  足迹列表
    update test data req json by name  visitList  token=${token}
    When visitList
    log response info
    common verify

zhwApp_075
    [Tags]  发布账号
    [Documentation]  获取模版列表
    update test data req json by name  getTemplateList  token=${token}
    When getTemplateList
    log response info
    common verify

zhwApp_076
    [Tags]  订单&买卖服务
    [Documentation]  卖家-发布帐号时选择游戏
    When publishAccountHotGame
    log response info
    common verify

zhwApp_077
    [Tags]  首页相关
    [Documentation]  获取游戏列表
    When getGameList
    log response info
    common verify

zhwApp_078
    [Tags]  首页相关
    [Documentation]  通过类型获取游戏列表
    When getGameListByCate
    log response info
    common verify

zhwApp_079
    [Tags]  首页相关
    [Documentation]  特价游戏专区
    When teJiaGameList
    log response info

zhwApp_080
    [Tags]  ios号主助手重构-首页
    [Documentation]  首页
    When haoHelperIndex
    log response info
    common verify

zhwApp_081
    [Tags]  ios号主助手重构-我的
    [Documentation]  生意管理首页
    update test data req json by name  businessManage  token=${token}
    When businessManage
    log response info
    verify success status

zhwApp_082
    [Tags]  搜索获取
    [Documentation]  获取评价新版(账号为空)
    When getAppraiseListNew
    log response info
    verify get appraise list  0  true

zhwApp_083
    [Tags]  搜索获取
    [Documentation]  获取评价新版
    update test data req json by name  getAppraiseListNew  actId=${actId}
    When getAppraiseListNew
    log response info
    verify get appraise list  1

zhwApp_084
    [Tags]  支付&提现
    [Documentation]  支付方式 v3
    update test data req json by name  payWay  token=${token}
    When payWay
    log response info
    verify pay way

zhwApp_085
    [Tags]  游戏圈(已废弃)
    [Documentation]  资讯列表
    update test data req json by name  infoList  token=${token}
    When infoList
    log response info
    verify info list